package ltd.dujiabao.springcloud.controller;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author : DuJiabao
 * @Project : springcloud
 * @Time : 2021/5/21 17:32
 * @Desc :
 */

@Api("订单处理")
@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {
  @Autowired
  RestTemplate restTemplate;
  @Value("${payment.url}")
  String paymentUrl;

  @GetMapping("/payment/consul")
  public String paymentConsul() {
    String result = restTemplate.getForObject(paymentUrl + "/payment/consul", String.class);
    log.info("获得信息为：" + result);
    return result;
  }
}
